import { EntitySchema } from '@mikro-orm/core';

export class LeUserOauth {
  id!: string;
  UID?: number;
  oauthID!: string;
  unionID!: string;
  type!: string;
  format?: string;
  isDeleted: boolean = false;
  createdTime?: string;
  updatedTime?: string;
  deletedTime?: string;
}

export const LeUserOauthSchema = new EntitySchema({
  class: LeUserOauth,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    UID: { type: 'number', fieldName: 'UID', nullable: true, index: '用户id' },
    oauthID: { type: 'string', fieldName: 'oauthID', length: 50 },
    unionID: { type: 'string', fieldName: 'unionID', length: 50 },
    type: { type: 'string', length: 20, default: '1' },
    format: { type: 'string', columnType: 'text', nullable: true },
    isDeleted: { type: 'boolean', default: false },
    createdTime: { type: 'string', columnType: 'bigint', nullable: true },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true },
  },
});
